const { AsyncSeriesHook } = require("tapable")

const hook = new AsyncSeriesHook(["name", "age"])

console.time("time")
hook.tapPromise("fn1", function (name, age) {
	return new Promise(resolve => {
		setTimeout(() => {
			console.log(`fn1=====>${name},${age}`)
			resolve()
		}, 2000)
	})
})


hook.tapPromise("fn2", function (name, age) {
	return new Promise(resolve => {
		setTimeout(() => {
			console.log(`fn2=====>${name},${age}`)
			resolve()
		}, 2000)
	})
})

hook.promise("lx", 25).then(res => {
	console.log("回调")
	console.timeEnd("time")
})